﻿--[[
Name: LibAvionOptions-2.0
Revision: $REVISION$
Author(s): Sirow (EU-Gorgonnash)
Website: http://code.google.com/p/sirow/
Description: Supply common options for Avion-2.0 (eg. GuideFrame)
Dependencies: LibAvion-2.0, CallbackHandler-1.0, AceGUI-3.0, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets
]]


-------------------------------------------------------------------------------
-- Library - Version Info & Dependencies
-------------------------------------------------------------------------------
-- Version
local MAJOR 		= "LibAvionOptions-2.0"
local MINOR 		= tonumber(("$REVISION$"):match("%d+")) or 0

-- Dependencies
if not LibStub 				  			then error(MAJOR .. " requires LibStub.") end
if not LibStub("LibAvion-2.0")  		then error(MAJOR .. " requires LibAvion-2.0.") end
if not LibStub("AceGUI-3.0")  			then error(MAJOR .. " requires AceGUI-3.0.") end
if not LibStub("LibSharedMedia-3.0")	then error(MAJOR .. " requires LibSharedMedia-3.0.") end
if not LibStub("CallbackHandler-1.0") 	then error(MAJOR .. " requires CallbackHandler-1.0.") end

-- Query Widgets
local AceGUI			= LibStub("AceGUI-3.0")
if not (
	AceGUI.WidgetRegistry["LSM30_Background"] and
	AceGUI.WidgetRegistry["LSM30_Sound"] and
	AceGUI.WidgetRegistry["LSM30_Font"]
)										then error(MAJOR .. " requires AceGUI-3.0-SharedMediaWidgets.") end 

-------------------------------------------------------------------------------
-- Library - Register
-------------------------------------------------------------------------------
-- Register
local LibAvionOpt 		= LibStub:NewLibrary(MAJOR, MINOR)
if not LibAvionOpt then return end

-- Embed CallbackHandler and LibSimpleTimer
LibAvionOpt.events		= LibAvionOpt.events or LibStub("CallbackHandler-1.0"):New(LibAvionOpt)

-- Load SharedMedia
local LibSharedMedia 	= LibStub("LibSharedMedia-3.0")


-------------------------------------------------------------------------------
-- Library - Variables
-------------------------------------------------------------------------------
-- Translation
local L 		= _G.LibAvionOpt__L

-- Set embeeding variables
LibAvionOpt.mixinTargets = LibAvionOpt.mixinTargets or {}
local mixins = {
	"BuildAnimationOptions",
	"HideGuideFrame",
	"ShowGuideFrame",
	"UpdateGuideFrame",
	"IsGuideFrameShown",
	
	"RegisterCallback",
	"UnregisterCallback",
	
	"guideCache",
}

-- Cache for animations/guides
LibAvionOpt.guideCache		= LibAvionOpt.guideCache 		or {}
LibAvionOpt.textureBrowser	= LibAvionOpt.textureBrowser	or {}
LibAvionOpt.caches			= LibAvionOpt.caches 			or {
	guideFrames 			= {},
	guideCounter			= 0,
}
local guideCache			= LibAvionOpt.guideCache
local guideFrames			= LibAvionOpt.caches.guideFrames
local guideCounter			= LibAvionOpt.caches.guideCounter

-- Load LibAvion stuff
local updateInterval 		= _G.LibAvion__updateInterval
local animationFrames		= _G.LibAvion__caches.animationFrames
local animationCounter		= _G.LibAvion__caches.animationCounter
local GetAvailableFrame 	= _G.LibAvion__GetAvailableFrame
local InitFrame				= _G.LibAvion__InitFrame
local UpdateAnimation		= _G.LibAvion__UpdateAnimation


-------------------------------------------------------------------------------
-- Library - Guide Frame - Core
-------------------------------------------------------------------------------
-- Create a new guide frame
local function MakeGuideFrame(ResizeIconPath)
	-- Basic frame
	local frame = CreateFrame("Frame", nil)
	frame:EnableMouse(true)
	frame:SetResizable(true)
	frame:SetMovable(true)
	frame:SetMinResize(22, 22)
	frame:SetFrameStrata("HIGH")
	frame:SetBackdropColor(1, 1, 1, 0)
	
	-- Mouseover highlight and config mode visualisation
	local texture = frame:CreateTexture(nil, "HIGHLIGHT")
	texture:SetAllPoints(frame)
	texture:SetTexture(0, 1, 1)
	texture:SetAlpha(0.3)

	-- Display some descriptive text
	local text = frame:CreateFontString(nil, "HIGHLIGHT")
	text:SetFontObject(GameFontHighlightSmall)
	text:SetPoint("CENTER", frame, "CENTER", 0, 0)
	text:SetText("ERROR")

	-- Resize mouse-drag image
	local resizeTexture = frame:CreateTexture(nil, "HIGHLIGHT")
	resizeTexture:SetHeight(16)
	resizeTexture:SetWidth(16)
	resizeTexture:SetTexture(ResizeIconPath .. "Resize.tga")
	resizeTexture:SetPoint("BOTTOMRIGHT", -2, 2)
	
	-- Add slider for rotation adjustment
	local slider = CreateFrame("Slider", nil, frame)
	slider:SetOrientation("HORIZONTAL")
	slider:SetWidth(200)
	slider:SetHeight(16)
	slider:SetPoint("BOTTOM", frame, "TOP", 0, 5)

	slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
	slider:SetBackdrop({
		bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
		edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
		tile = true,
		edgeSize = 8,
		tileSize = 8,
		insets = {
			left = 3,
			right = 3,
			top = 3,
			bottom= 3
		}
	})
	slider:SetBackdropColor(0, 1, 1, 1)
	slider:SetBackdropBorderColor(0, 1, 1, 1)
	slider:SetMinMaxValues(0, 359)
	slider:SetValue(0)
	slider:SetValueStep(1)
	
	-- Will open options menu for this animation
	local menuButton = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
	menuButton:SetWidth(60)
	menuButton:SetHeight(25)
	menuButton:SetText(L["Menu"])
	menuButton:SetPoint("TOP", frame, "BOTTOM", 0, -5)
	
	-- Button to mirror allong x axis
	local mirrorX = CreateFrame("Button", nil, menuButton, "UIPanelButtonTemplate")
	mirrorX:SetWidth(60)
	mirrorX:SetHeight(25)
	mirrorX:SetText(L["MirrorX"])
	mirrorX:SetPoint("RIGHT", menuButton, "LEFT", 0, 0)
	
	-- Button to mirror allong y axis
	local mirrorY = CreateFrame("Button", nil, menuButton, "UIPanelButtonTemplate")
	mirrorY:SetWidth(60)
	mirrorY:SetHeight(25)
	mirrorY:SetText(L["MirrorY"])
	mirrorY:SetPoint("LEFT", menuButton, "RIGHT", 0, 0)
	
	-- Close Button
	local closeButton = CreateFrame("Button", nil, menuButton, "UIPanelCloseButton")
	closeButton:SetFrameLevel(5)
	closeButton:SetPoint("TOP", menuButton, "BOTTOM", 0, -5)
	
	-- Add everything to the cache
	guideFrames[guideCounter] = {
		inUse 			= true,
		frame 			= frame,
		texture 		= texture,
		text 			= text,
		resizeTexture	= resizeTexture,
		slider 			= slider,
		menuButton 		= menuButton,
		mirrorX 		= mirrorX,
		mirrorY 		= mirrorY,
		closeButton 	= closeButton,
		configMode		= 0
	}
	
	-- Increment number of frames and return new number
	guideCounter = guideCounter + 1
	return (guideCounter-1)
end


-- Get an unused frame or create a new one (only ID)
local function GetAvailableGuideFrameID(ResizeIconPath)
	-- Is there any unused/invisible frame?
	for index, cache in pairs(guideFrames) do
		if (not cache.inUse) then
			-- Enable inUse and return index
			cache.inUse 		= true
			cache.configMode	= 0
			
			return index
		end
	end
	
	-- If not, create one!
	return MakeGuideFrame(ResizeIconPath)
end


-- Get an unused frame or create a new one
local function GetAvailableGuideFrame(ResizeIconPath)
	local frameID = GetAvailableGuideFrameID(ResizeIconPath)
	return guideFrames[frameID], frameID
end


-- Will return scale of animation frame, calculated from the guideFrame
local function GetGuideFrameScale(guideObject, animationTable)
	local L1, L2 = sqrt(
		animationTable.misc.size.width  * animationTable.misc.size.width + 
		animationTable.misc.size.height * animationTable.misc.size.height
	),
	sqrt(
		guideObject.frame:GetWidth()  * guideObject.frame:GetWidth()  + 
		guideObject.frame:GetHeight() * guideObject.frame:GetHeight()
	) / 1.414

	return (L2 / L1)
end


-- Update the panel to match the guide frame's location (but don't save to database until we're finished)
local function GetGuideFramePosition(guideObject)
	local x, y = guideObject.frame:GetCenter()
	x = (x - (UIParent:GetWidth()  * UIParent:GetEffectiveScale()) / 2) / UIParent:GetEffectiveScale()
	y = (y - (UIParent:GetHeight() * UIParent:GetEffectiveScale()) / 2) / UIParent:GetEffectiveScale()
	
	return x, y
end


-- Update postition of frame, based on position of guideFrame
local function MouseWheelListener(self, animationID, direction)
	-- Fetch required tables
	local animationTable 	= guideCache[animationID].animationTable
	local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]

	-- If not in animation mode, update size(w&h) (and position)
	if (guideObject.configMode == 0) then
		animationTable.init.alpha = animationTable.init.alpha + direction * 0.01
		if (animationTable.init.alpha < 0) then
			animationTable.init.alpha = 0
		elseif (animationTable.init.alpha > 1) then
			animationTable.init.alpha = 1
		end
	elseif (guideObject.configMode == 1) then
		if (animationTable.anim.misc.isAnimated.alpha) then
			animationTable.anim.alpha = animationTable.anim.alpha + direction * 0.01
			if (animationTable.anim.alpha < 0) then
				animationTable.anim.alpha = 0
			elseif (animationTable.anim.alpha > 1) then
				animationTable.anim.alpha = 1
			end
		end
	end

	-- Update animation
	self:UpdateGuideFrame(animationID)
	
	-- Trigger update event
	self.events:Fire("LibAvion_GUIUpdate", animationID)
end


-- Update postition of frame, based on position of guideFrame
local function MoveListener(self, animationID)
	-- Fetch required tables
	local animationTable 	= guideCache[animationID].animationTable
	local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]
	local x, y 				= GetGuideFramePosition(guideObject)

	-- If not in animation mode, update size(w&h) (and position)
	if (guideObject.configMode == 0) then
		animationTable.init.position = {
			x = x,
			y = y
		}
	elseif (guideObject.configMode == 1) then
		if (animationTable.anim.misc.isAnimated.position) then
			animationTable.anim.position = {
				x = x,
				y = y
			}
		end
	elseif (guideObject.configMode == 2) then
		if (animationTable.misc.fadeMode == 3) then
			animationTable.fade.position = {
				x = x,
				y = y
			}
		end
	end
	
	-- Update animation
	self:UpdateGuideFrame(animationID)
	
	-- Trigger update event
	self.events:Fire("LibAvion_GUIUpdate", animationID)
end


-- Update size of frame, based on size of guideFrame
local function ResizeListener(self, animationID)
	-- Fetch required tables
	local animationTable 	= guideCache[animationID].animationTable
	local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]
	
	-- Update size (w&h)
	if (guideObject.configMode == 0) then
		animationTable.misc.size = {
			width  = guideObject.frame:GetWidth()  / 1.414,
			height = guideObject.frame:GetHeight() / 1.414
		}
		
	-- Update animation scale
	elseif (guideObject.configMode == 1) then
		if (animationTable.anim.misc.isAnimated.scale) then
			animationTable.anim.scale = GetGuideFrameScale(guideObject, animationTable)
		end
		
	-- Update fade scale
	elseif (guideObject.configMode == 2) then
		if (animationTable.misc.fadeMode == 3) then
			animationTable.fade.scale = GetGuideFrameScale(guideObject, animationTable)
		end
	end
	
	-- Update animation
	self:UpdateGuideFrame(animationID)
	
	-- Trigger update event
	self.events:Fire("LibAvion_GUIUpdate", animationID)
end


-- Update rotation
local function SliderListener(self, animationID) 
	-- Fetch required tables
	local animationTable 	= guideCache[animationID].animationTable
	local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]

	-- In start-value mode
	if (guideObject.configMode == 0) then
		animationTable.init.rotation = guideObject.slider:GetValue() / 180 * math.pi

	-- In animation-value mode
	elseif (guideObject.configMode == 1) then
		if (animationTable.anim.misc.isAnimated.rotation) then
			animationTable.anim.rotation = guideObject.slider:GetValue() / 180 * math.pi
		end
		
	-- Fade-value mode
	elseif (guideObject.configMode == 2) then
		if (animationTable.misc.fadeMode == 3) then
			animationTable.fade.rotation = guideObject.slider:GetValue() / 180 * math.pi
		end
	end
	
	-- Update animation
	self:UpdateGuideFrame(animationID)
	
	-- Trigger update event
	self.events:Fire("LibAvion_GUIUpdate", animationID)
end


-- This is called each time mouse button is pressed (and hold) 
local function MouseDownListener(self, animationID)
	-- Fetch required tables
	local animationTable 	= guideCache[animationID].animationTable
	local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]
		
	-- Right-click mean, change config mode between start and animate values
	if (arg1 == "RightButton") then
		-- Switch config mode
		if (animationTable.misc.fadeMode == 3) then
			guideObject.configMode = (guideObject.configMode + 1) % 3
		else
			guideObject.configMode = (guideObject.configMode + 1) % 2
		end
		
		-- Adjust animation frame
		self:UpdateGuideFrame(animationID)
		
	-- On left-clicks, listen for mouse-dragging
	elseif (arg1 == "LeftButton") then
		-- Set vars to figure out if the mouse is in the resize area or not
		local screenX, screenY = GetCursorPosition()
		local panelX = guideObject.frame:GetRight()
		local panelY = guideObject.frame:GetBottom()

		-- Adjust for screen scale
		local scale = guideObject.frame:GetEffectiveScale()
		panelX = panelX * scale
		panelY = panelY * scale
		
		-- Set bounds for lower-right hand corner (inside resize texture)
		local check1 = screenX <= panelX + 14
		local check2 = screenX >= panelX - 14
		local check3 = screenY <= panelY + 14
		local check4 = screenY >= panelY - 14
		
		-- Start resizing
		if check1 and check2 and check3 and check4 then
			-- Cancel updating for certain settings
			if (guideObject.configMode == 1 and not animationTable.anim.misc.isAnimated.scale) then
				return
			elseif (guideObject.configMode == 2 and animationTable.misc.fadeMode ~= 3) then
				return
			end
			
			-- Attach an OnUpdate call which fires every repaint while we're resizing
			guideObject.frame:SetScript("OnUpdate", function() ResizeListener(self, animationID) end)
		
			-- System call
			guideObject.frame:StartSizing("BOTTOMRIGHT")
			
		-- Start moving
		else
			-- Cancel updating for certain settings
			if (guideObject.configMode == 1 and not animationTable.anim.misc.isAnimated.scale) then
				return
			elseif (guideObject.configMode == 2 and animationTable.misc.fadeMode ~= 3) then
				return
			end
			
			-- Attach an OnUpdate call which fires every repaint while we're moving
			guideObject.frame:SetScript("OnUpdate", function() MoveListener(self, animationID) end)
		
			-- System call
			guideObject.frame:StartMoving()
		end
	end
	
	-- Trigger update event
	self.events:Fire("LibAvion_GUIUpdate", animationID)
end


-- Mouse has been released, set and save settings
local function MouseUpListener(self, animationID)
-- Fetch required tables
	local animationTable 	= guideCache[animationID].animationTable
	local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]
	
	-- Remove the move/resize listeners
	guideObject.frame:SetScript("OnUpdate", nil)
	
	-- Nothing to update on mouse up when just config mode changed
	if (arg1 ~= "RightButton") then
		-- Stop moving or resizing
		guideObject.frame:StopMovingOrSizing()

		-- Update position once more
		MoveListener(self, animationID)
		ResizeListener(self, animationID)
	end
end


-------------------------------------------------------------------------------
-- Library - Options/GuideFrame - API
-------------------------------------------------------------------------------
--[[
######################################################
# :PathToIcons(ResizeIconPath)
# Notes:
#  Set path to Resize.tga used within the guide frame
# Arguments:
#  ResizeIconPath (string) - Path to were Resize.tga is located (trailed by \\)
# Returns:
######################################################
]]--
function LibAvionOpt:PathToIcons(ResizeIconPath)
	self.ResizeIconPath = ResizeIconPath
end


--[[
######################################################
# :Ace3Options( animationID, animationTable, textureList, functionList, advanced)
# Notes:
#	Builds an AceConfig3 compatible optionstable for given animation.
# Arguments:
#	animationID (string) - The unique identifier for this animation.
#	animationTable (table) - The table that defines this animation, see EOF of LibAvion-2.0.lua for more.
#	textureList (table) - List of available textures (key=NAME, value=PATH)
#	functionList (table) - List of available fuctions (key=FUNCTION-POINTER, value=NAME)
#	advanved (bool) - Enable advaned options
# Returns:
#	Options table for editing animation with an AceConfig3 addon.
######################################################
]]--
function LibAvionOpt:Ace3Options(animationID, animationTable, textureList, functionList, advanced)
	-- Create  a list of function ["name"] = "name"
	local list = {}
	for _, value in pairs(functionList) do
		list[value] = value
	end
	
	-- Return OptionsTable
	return {
		init 		= {
			order 		= 2,
			type 		= "group",
			name 		= L["StartValues"],
			desc 		= L["StartValues_Desc"],
			args 		= {
				alpha 		= {
					order 		= 1,
					type 		= "range",
					name 		= L["Alpha"],
					desc 		= L["Alpha_Desc"],
					get 		= function()
						return animationTable.init.alpha
					end,
					set 		= function(info, val)
						animationTable.init.alpha = val
						if (not advanced) then
							animationTable.anim.alpha = val
						end
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 1,
					step 		= 0.01,
				},
				color 		= {
					order 		= 2,
					type 		= "color",
					name 		= L["Color"],
					desc 		= L["Color_Desc"],
					get 		= function()
						return animationTable.init.color.r, animationTable.init.color.g, animationTable.init.color.b
					end,
					set 		= function(info, r, g, b)
						animationTable.init.color.r = r
						animationTable.init.color.g = g
						animationTable.init.color.b = b
						if (not advanced) then
							animationTable.anim.color.r = r
							animationTable.anim.color.g = g
							animationTable.anim.color.b = b
							animationTable.fade.color.r = r
							animationTable.fade.color.g = g
							animationTable.fade.color.b = b
						end
						
						self:UpdateGuideFrame(animationID)
					end,
					hasAlpha 	= false
				},
				positionX 	= {
					order 		= 3,
					type 		= "range",
					name 		= L["PositionX"],
					desc 		= L["PositionX_Desc"],
					get 		= function()
						return animationTable.init.position.x
					end,
					set 		= function(info, val)
						animationTable.init.position.x = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					step 		= 1,
				},
				positionY	= {
					order 		= 4,
					type		= "range",
					name 		= L["PositionY"],
					desc 		= L["PositionY_Desc"],
					get 		= function()
						return animationTable.init.position.y
					end,
					set 		= function(info, val)
						animationTable.init.position.y = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					step 		= 1,
				},
				scale 		= {
					order 		= 5,
					type 		= "range",
					name 		= L["Scale"],
					desc		= L["Scale_Desc"],
					get 		= function()
						return animationTable.init.scale
					end,
					set 		= function(info, val)
						animationTable.init.scale = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0.01,
					max 		= 10,
					step 		= 0.01,
					hidden		= not advanced,
				},
				rotation 	= {
					order 		= 6,
					type 		= "range",
					name 		= L["Rotation"],
					desc 		= L["Rotation_Desc"],
					get 		= function()
						return animationTable.init.rotation / math.pi * 180
					end,
					set 		= function(info, val)
						animationTable.init.rotation = val * math.pi / 180
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 359,
					step 		= 1,
				},
				duration 	=  {
					order 		= 7,
					type 		= "range",
					name 		= L["WaitTime"],
					desc 		= L["WaitTime_Desc"],
					get 		= function()
						return animationTable.init.misc.duration
					end,
					set 		= function(info, val)
						animationTable.init.misc.duration = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 30,
					step 		= updateInterval,
					hidden		= not advanced,
				},
			},
		},
		anim 		= {
			order 		= 3,
			type 		= "group",
			name 		= L["AnimationValues"],
			desc 		= L["AnimationValues_Desc"],
			args 		= { 
				alpha 		= {
					order 		= 1,
					type 		= "range",
					name 		= L["Alpha"],
					desc 		= L["Alpha_Desc"],
					get 		= function()
						return animationTable.anim.alpha
					end,
					set 		= function(info, val)
						animationTable.anim.alpha = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 1,
					step 		= 0.01,
					hidden		= not advanced,
				},
				color 		= {
					order 		= 2,
					type 		= "color",
					name 		= L["Color"],
					desc 		= L["Color_Desc"],
					get 		= function()
						return animationTable.anim.color.r, animationTable.anim.color.g, animationTable.anim.color.b
					end,
					set 		= function(info, r, g, b, a)
						animationTable.anim.color.r = r
						animationTable.anim.color.g = g
						animationTable.anim.color.b = b
						
						self:UpdateGuideFrame(animationID)
					end,
					hidden		= not advanced,
				},
				positionX 	= {
					order 		= 3,
					type 		= "range",
					name 		= L["PositionX"],
					desc 		= L["PositionX_Desc"],
					get 		= function()
						return animationTable.anim.position.x
					end,
					set 		= function(info, val)
						animationTable.anim.position.x = val
						if (not advanced) then
							animationTable.fade.position.x = val
						end
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					step 		= 1,
				},
				positionY 	= {
					order 		= 4,
					type 		= "range",
					name 		= L["PositionY"],
					desc 		= L["PositionY_Desc"],
					get 		= function()
						return animationTable.anim.position.y
					end,
					set 		= function(info, val)
						animationTable.anim.position.y = val
						if (not advanced) then
							animationTable.fade.position.y = val
						end
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					step 		= 1,
				},
				scale 		= {
					order 		= 5,
					type		= "range",
					name 		= L["Scale"],
					desc 		= L["Scale_Desc"],
					get 		= function()
						return animationTable.anim.scale
					end,
					set 		= function(info, val)
						animationTable.anim.scale = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0.01,
					max 		= 10,
					step 		= 0.01,
				},
				rotation 	= {
					order 		= 6,
					type 		= "range",
					name 		= L["Rotation"],
					desc 		= L["Rotation_Desc"],
					get 		= function()
						return animationTable.anim.rotation / math.pi * 180
					end,
					set 		= function(info, val)
						animationTable.anim.rotation = val * math.pi / 180
						if (not advanced) then
							animationTable.fade.rotation = val * math.pi / 180
						end
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 359,
					step 		= 1,
				},
				animFunc 	= {
					order 		= 7,
					type 		= "group",
					name 		= L["AnimationFunc"],
					desc 		= L["animationFuncNameDesc"],
					hidden		= not advanced,
					args 		= { 
						alpha 		= {
							order 		= 1,
							type 		= "select",
							name 		= L["Alpha"],
							desc 		= L["Alpha_Desc"],
							values 		= list,
							get 		= function()
								return functionList[animationTable.anim.misc.animationFunc.alpha]
							end,
							set 		= function(info, val)
								if (animationTable.anim.misc.animationFuncName.alpha) then
									animationTable.anim.misc.animationFuncName.alpha	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.anim.misc.animationFunc.alpha = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						color 		= {
							order 		= 2,
							type 		= "select",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							values 		= list,
							
							get 		= function()
								return functionList[animationTable.anim.misc.animationFunc.color]
							end,
							set 		= function(info, val)
								if (animationTable.anim.misc.animationFuncName.color) then
									animationTable.anim.misc.animationFuncName.color	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.anim.misc.animationFunc.color = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
						position	= {
							order 		= 3,
							type 		= "select",
							name 		= L["Position"],
							desc 		= L["Position_Desc"],
							values 		= list,
							
							get 		= function()
								return functionList[animationTable.anim.misc.animationFunc.position]
							end,
							set 		= function(info, val)
								if (animationTable.anim.misc.animationFuncName.position) then
									animationTable.anim.misc.animationFuncName.position	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.anim.misc.animationFunc.position = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
						scale 		= {
							order 		= 4,
							type 		= "select",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							values 		= list,
							
							get 		= function()
								return functionList[animationTable.anim.misc.animationFunc.scale]
							end,
							set 		= function(info, val)
								if (animationTable.anim.misc.animationFuncName.scale) then
									animationTable.anim.misc.animationFuncName.scale	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.anim.misc.animationFunc.scale = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
						rotation 	= {
							order 		= 5,
							type 		= "select",
							name 		= L["Rotation"],
							desc 		= L["Rotation_Desc"],
							values 		= list,
							
							get 		= function()
								return functionList[animationTable.anim.misc.animationFunc.rotation]
							end,
							set 		= function(info, val)
								if (animationTable.anim.misc.animationFuncName.rotation) then
									animationTable.anim.misc.animationFuncName.rotation	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.anim.misc.animationFunc.rotation = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
					},
				},
				addRandom 	= {
					order 		= 8,
					type 		= "group",
					name 		= L["AddRandom"],
					desc 		= L["AddRandom_Desc"],
					hidden		= not advanced,
					args 		= {
						alpha 		= {
							order 		= 1,
							type 		= "range",
							name 		= L["Alpha"],
							desc 		= L["Alpha_Desc"],
							get 		= function()
								if (animationTable.anim.misc.addRandom.alpha) then
									return animationTable.anim.misc.addRandom.alpha
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.anim.misc.addRandom.alpha = nil
								else
									animationTable.anim.misc.addRandom.alpha = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= 1,
							step 		= 0.01,
						},
						color 		= {
							order 		= 2,
							type 		= "range",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							get 		= function()
								if (animationTable.anim.misc.addRandom.color) then
									return animationTable.anim.misc.addRandom.color
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.anim.misc.addRandom.color = nil
								else
									animationTable.anim.misc.addRandom.color = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= 1,
							step 		= 0.01,
						},
						position 	= {
							order 		= 3,
							type 		= "range",
							name 		= L["Position"],
							desc 		= L["Position_Desc"],
							get 		= function()
								if (animationTable.anim.misc.addRandom.position) then
									return animationTable.anim.misc.addRandom.position
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.anim.misc.addRandom.position = nil
								else
									animationTable.anim.misc.addRandom.position = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= math.floor(GetScreenWidth() / UIParent:GetScale()),
							step 		= 1,
						},
						scale 		= {
							order 		= 4,
							type 		= "range",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							get 		= function()
								if (animationTable.anim.misc.addRandom.scale) then
									return animationTable.anim.misc.addRandom.scale
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.anim.misc.addRandom.scale = nil
								else
									animationTable.anim.misc.addRandom.scale = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0.01,
							max 		= 10,
							step 		= 0.01,
						},
						rotation 	= {
							order 		= 5,
							type 		= "range",
							name 		= L["Rotation"],
							desc 		= L["Rotation_Desc"],
							get 		= function()
								if (animationTable.anim.misc.addRandom.rotation) then
									return animationTable.anim.misc.addRandom.rotation
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.anim.misc.addRandom.rotation = nil
								else
									animationTable.anim.misc.addRandom.rotation = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= 359,
							step 		= 1,
						},
					},
				} ,
				isAnimated 	= {
					order 		= 9,
					type 		= "group",
					name 		= L["IsAnimated"],
					desc 		= L["IsAnimated_Desc"],
					hidden		= not advanced,
					args 		= {
						alpha 		= {
							order 		= 1,
							type		= "toggle",
							name 		= L["Alpha"],
							desc 		= L["Alpha_Desc"],
							get 		= function()
								return animationTable.anim.misc.isAnimated.alpha
							end,
							set 		= function()
								animationTable.anim.misc.isAnimated.alpha = not animationTable.anim.misc.isAnimated.alpha
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						color 		= {
							order 		= 2,
							type 		= "toggle",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							get 		= function()
								return animationTable.anim.misc.isAnimated.color
							end,
							set 		= function()
								animationTable.anim.misc.isAnimated.color = not animationTable.anim.misc.isAnimated.color
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						position 	= {
							order 		= 3,
							type 		= "toggle",
							name 		= L["Position"],
							desc 		= L["Position_Desc"],
							get 		= function()
								return animationTable.anim.misc.isAnimated.position
							end,
							set 		= function()
								animationTable.anim.misc.isAnimated.position = not animationTable.anim.misc.isAnimated.position
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						scale 		= {
							order 		= 4,
							type 		= "toggle",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							get 		= function()
								return animationTable.anim.misc.isAnimated.scale
							end,
							set 		= function()
								animationTable.anim.misc.isAnimated.scale = not animationTable.anim.misc.isAnimated.scale
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						rotation 	= {
							order 		= 5,
							type 		= "toggle",
							name 		= L["Rotation"],
							desc 		= L["Rotation_Desc"],
							get 		= function()
								return animationTable.anim.misc.isAnimated.rotation
							end,
							set 		= function()
								animationTable.anim.misc.isAnimated.rotation = not animationTable.anim.misc.isAnimated.rotation
								
								self:UpdateGuideFrame(animationID)
							end,
						},
					},
				},
				duration 	= {
					order 		= 10,
					type 		= "range",
					name 		= L["AnimationTime"],
					desc 		= L["AnimationTime_Desc"],
					get 		= function()
						return animationTable.anim.misc.duration
					end,
					set 		= function(info, val)
						animationTable.anim.misc.duration = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 30,
					step 		= updateInterval,
				},
			},
		},
		fade 		= {
			order 		= 4,
			type 		= "group",
			name 		= L["FadeValues"],
			desc 		= L["FadeValues_Desc"],
			args 		= { 
				color 		= {
					order 		= 2,
					type 		= "color",
					name 		= L["Color"],
					desc 		= L["Color_Desc"],
					get 		= function()
						return animationTable.fade.color.r, animationTable.fade.color.g, animationTable.fade.color.b
					end,
					set 		= function(info, r, g, b, a)
						animationTable.fade.color.r = r
						animationTable.fade.color.g = g
						animationTable.fade.color.b = b
						
						self:UpdateGuideFrame(animationID)
					end,
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
				} or nil,
				positionX 	= {
					order		= 3,
					type 		= "range",
					name 		= L["PositionX"],
					desc 		= L["PositionX_Desc"],
					get 		= function()
						return animationTable.fade.position.x
					end,
					set 		= function(info, val)
						animationTable.fade.position.x = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					step 		= 1,
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
				},
				positionY 	= {
					order 		= 4,
					type 		= "range",
					name 		= L["PositionY"],
					desc 		= L["PositionY_Desc"],
					get 		= function()
						return animationTable.fade.position.y
					end,
					set 		= function(info, val)
						animationTable.fade.position.y = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					step 		= 1,
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
				},
				scale 		= {
					order 		= 5,
					type 		= "range",
					name 		= L["Scale"],
					desc 		= L["Scale_Desc"],
					get 		= function()
						return animationTable.fade.scale
					end,
					set			= function(info, val)
						animationTable.fade.scale = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0.01,
					max 		= 10,
					step 		= 0.01,
					disabled	= animationTable.misc.fadeMode ~= 3,
				},
				rotation	= {
					order 		= 6,
					type 		= "range",
					name 		= L["Rotation"],
					desc 		= L["Rotation_Desc"],
					get 		= function()
						return animationTable.fade.rotation / math.pi * 180
					end,
					set 		= function(info, val)
						animationTable.fade.rotation = val * math.pi / 180
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 359,
					step 		= 1,
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
				},
				animationFunc = {
					order 		= 7,
					type 		= "group",
					name 		= L["AnimationFunc"],
					desc 		= L["animationFuncNameDesc"],
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
					args 		= { 
						alpha 		= {
							order 		= 1,
							type 		= "select",
							name 		= L["Alpha"],
							desc 		= L["Alpha_Desc"],
							values 		= list,
							get 		= function()
								return functionList[animationTable.fade.misc.animationFunc.alpha]
							end,
							set			= function(info, val)
								if (animationTable.fade.misc.animationFuncName.alpha) then
									animationTable.fade.misc.animationFuncName.alpha	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.fade.misc.animationFunc.alpha = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						color 		= {
							order 		= 2,
							type 		= "select",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							values 		= list,
							get 		= function()
								return functionList[animationTable.fade.misc.animationFunc.color]
							end,
							set 		= function(info, val)
								if (animationTable.fade.misc.animationFuncName.color) then
									animationTable.fade.misc.animationFuncName.color	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.fade.misc.animationFunc.color = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
						position 	= {
							order 		= 3,
							type 		= "select",
							name 		= L["Position"],
							desc 		= L["Position_Desc"],
							values 		= list,
							get 		= function()
								return functionList[animationTable.fade.misc.animationFunc.position]
							end,
							set 		= function(info, val)
								if (animationTable.fade.misc.animationFuncName.position) then
									animationTable.fade.misc.animationFuncName.position	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.fade.misc.animationFunc.position = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
						scale 		= {
							order 		= 4,
							type 		= "select",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							values 		= list,
							get 		= function()
								return functionList[animationTable.fade.misc.animationFunc.scale]
							end,
							set 		= function(info, val)
								if (animationTable.fade.misc.animationFuncName.scale) then
									animationTable.fade.misc.animationFuncName.scale	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.fade.misc.animationFunc.scale = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
						rotation 	= {
							order 		= 5,
							type 		= "select",
							name 		= L["Rotation"],
							desc 		= L["Rotation_Desc"],
							values 		= list,
							get 		= function()
								return functionList[animationTable.fade.misc.animationFunc.rotation]
							end,
							set 		= function(info, val)
								if (animationTable.fade.misc.animationFuncName.rotation) then
									animationTable.fade.misc.animationFuncName.rotation	= val
								end
								for func, name in pairs(functionList) do 
									if (name == val) then
										animationTable.fade.misc.animationFunc.rotation = func
										break
									end
								end
								
								self:UpdateGuideFrame(animationID)
							end,
						}, 
					},
				},
				addRandom 	= {
					order 		= 8,
					type 		= "group",
					name 		= L["AddRandom"],
					desc 		= L["AddRandom_Desc"],
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
					args 		= {
						alpha 		= {
							order		= 1,
							type 		= "range",
							name 		= L["Alpha"],
							desc 		= L["Alpha_Desc"],
							get 		= function()
								if (animationTable.fade.misc.addRandom.alpha) then
									return animationTable.fade.misc.addRandom.alpha
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.fade.misc.addRandom.alpha = nil
								else
									animationTable.fade.misc.addRandom.alpha = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= 1,
							step 		= 0.01,
						},
						color 		= {
							order 		= 2,
							type 		= "range",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							get 		= function()
								if (animationTable.fade.misc.addRandom.color) then
									return animationTable.fade.misc.addRandom.color
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.fade.misc.addRandom.color = nil
								else
									animationTable.fade.misc.addRandom.color = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= 1,
							step 		= 0.01,
						},
						position 	= {
							order 		= 3,
							type 		= "range",
							name 		= L["Position"],
							desc 		= L["Position_Desc"],
							get 		= function()
								if (animationTable.fade.misc.addRandom.position) then
									return animationTable.fade.misc.addRandom.position
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.fade.misc.addRandom.position = nil
								else
									animationTable.fade.misc.addRandom.position = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= math.floor(GetScreenWidth() / UIParent:GetScale()),
							step 		= 1,
						},
						scale 		= {
							order		= 4,
							type 		= "range",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							get 		= function()
								if (animationTable.fade.misc.addRandom.scale) then
									return animationTable.fade.misc.addRandom.scale
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.fade.misc.addRandom.scale = nil
								else
									animationTable.fade.misc.addRandom.scale = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0.01,
							max 		= 10,
							step 		= 0.01,
						},
						rotation 	= {
							order 		= 5,
							type		= "range",
							name 		= L["Rotation"],
							desc 		= L["Rotation_Desc"],
							get 		= function()
								if (animationTable.fade.misc.addRandom.rotation) then
									return animationTable.fade.misc.addRandom.rotation
								else
									return 0
								end
							end,
							set 		= function(info, val)
								if (val == 0) then
									animationTable.fade.misc.addRandom.rotation = nil
								else
									animationTable.fade.misc.addRandom.rotation = val
								end
								
								self:UpdateGuideFrame(animationID)
							end,
							min 		= 0,
							max 		= 359,
							step 		= 1,
						},
					},
				},
				isAnimated 		= {
					order 		= 9,
					type 		= "group",
					name 		= L["IsAnimated"],
					desc 		= L["IsAnimated_Desc"],
					hidden		= not advanced,
					disabled	= animationTable.misc.fadeMode ~= 3,
					args 		= {
						color 		= {
							order		= 2,
							type 		= "toggle",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							get 		= function()
								return animationTable.fade.misc.isAnimated.color
							end,
							set 		= function()
								animationTable.fade.misc.isAnimated.color = not animationTable.fade.misc.isAnimated.color
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						position 	= {
							order 		= 3,
							type 		= "toggle",
							name 		= L["Position"],
							desc		= L["Position_Desc"],
							get 		= function()
								return animationTable.fade.misc.isAnimated.position
							end,
							set 		= function()
								animationTable.fade.misc.isAnimated.position = not animationTable.fade.misc.isAnimated.position
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						scale 		= {
							order 		= 4,
							type 		= "toggle",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							get 		= function()
								return animationTable.fade.misc.isAnimated.scale
							end,
							set 		= function()
								animationTable.fade.misc.isAnimated.scale = not animationTable.fade.misc.isAnimated.scale
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						rotation 	= {
							order 		= 5,
							type 		= "toggle",
							name 		= L["Rotation"],
							desc 		= L["Rotation_Desc"],
							get			= function()
								return animationTable.fade.misc.isAnimated.rotation
							end,
							set 		= function()
								animationTable.fade.misc.isAnimated.rotation = not animationTable.fade.misc.isAnimated.rotation
								
								self:UpdateGuideFrame(animationID)
							end,
						},
					},
				},
				duration 		= {
					order 			= 10,
					type 			= "range",
					name 			= L["FadeTime"],
					desc 			= L["FadeTime_Desc"],
					get 			= function()
						return animationTable.fade.misc.duration
					end,
					set 			= function(info, val)
						animationTable.fade.misc.duration = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 			= 0,
					max 			= 30,
					step 			= updateInterval,
				},
			},
		},
		text 		= {
			order 		= 5,
			type 		= "group",
			name		= L["TextOutput"],
			desc 		= L["TextOutput_Desc"],
			args 		= { 
				enabled 	= {
					order 		= 1,
					type 		= "toggle",
					name 		= L["Enable"],
					desc 		= L["EnableText_Desc"],
					get 		= function()
						return animationTable.text ~= nil
					end,
					set 		= function(info, val)
						if (val) then
							if (not animationTable.text) then
								animationTable.text = {
									text 		= "",
									font 		= "Fonts\\FRIZQT__.TTF",
									fontName 	= "Friz Quadrata TT",
									size 		= 20,
									color		= {
										r			= 1.0,
										g			= 1.0,
										b			= 1.0
									},
									alpha			= 0.5,
									isAnimated 	= {
										alpha		= false,
										color		= false,
										scale		= false,
										position	= false,
									},
									outline		= true,
									position 	= {
										x			= 0,
										y			= -animationTable.misc.size.height / 2,
									},
								}
							end
						else
							animationTable.text = nil
						end
						
						self:UpdateGuideFrame(animationID)
						self.events:Fire("LibAvion_GUIUpdate", animationID)
					end,
				},
				text 		= {
					order 		= 2,
					type 		= "input",
					name 		= L["TextString"],
					desc 		= L["TextString_Desc"],
					usage 		= L["TextString_Usage"],
					get 		= function()
						return animationTable.text and animationTable.text.text or ""
					end,
					set 		= function(info, val)
						animationTable.text.text = val
						
						self:UpdateGuideFrame(animationID)
					end,
					disabled 	= animationTable.text == nil,
				},
				positionX 	= {
					order 		= 3,
					type 		= "range",
					name 		= L["PositionX"],
					desc 		= L["PositionX_Desc"],
					get 		= function()
						return animationTable.text and animationTable.text.position.x or 0
					end,
					set 		= function(info, val)
						animationTable.text.position.x = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenHeight() / UIParent:GetScale() / 2),
					step 		= 1,
					disabled 	= animationTable.text == nil,
				},
				positionY 	= {
					order 		= 3,
					type 		= "range",
					name 		= L["PositionY"],
					desc 		= L["PositionY_Desc"],
					get 		= function()
						return animationTable.text and animationTable.text.position.y or 0
					end,
					set 		= function(info, val)
						animationTable.text.position.y = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= -math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					max 		= math.floor(GetScreenWidth() / UIParent:GetScale() / 2),
					step 		= 1,
					disabled 	= animationTable.text == nil,
				},
				fontTyp 	= {
					order 		= 4,
					type 		= "select",
					name 		= L["FontTyp"],
					desc 		= L["FontTyp_Desc"],
					values 		= LibSharedMedia:HashTable(LibSharedMedia.MediaType.FONT),
					get 		= function()
						return animationTable.text and animationTable.text.fontName
					end,
					set 		= function(info, val)
						animationTable.text.fontName 	= val
						animationTable.text.font		= LibSharedMedia:Fetch(LibSharedMedia.MediaType.FONT, val)
						
						self:UpdateGuideFrame(animationID)
					end,
					dialogControl = AceGUI.WidgetRegistry["LSM30_Font"] and "LSM30_Font" or nil,
					disabled 	= animationTable.text == nil,
				},
				fontTypC	= {
					order 		= 5,
					type 		= "input",
					name 		= L["TextString"],
					desc 		= L["TextString_Desc"],
					usage 		= L["TextString_Usage"],
					get 		= function()
						return animationTable.text and animationTable.text.font or ""
					end,
					set 		= function(info, val)
						animationTable.text.fontName 	= nil
						animationTable.text.font		= val
						
						self:UpdateGuideFrame(animationID)
					end,
					disabled 	= animationTable.text == nil,
					hidden		= not advanced,
				} or nil,
				fontSize 	= {
					order 		= 6,
					type 		= "range",
					name 		= L["FontSize"],
					desc 		= L["FontSize_Desc"],
					get 		= function()
						return animationTable.text and animationTable.text.size or 0
					end,
					set 		= function(info, val)
						animationTable.text.size = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 1,
					max 		= 72,
					step 		= 1,
					disabled 	= animationTable.text == nil,
				},
				color 		= {
					order 		= 7,
					type 		= "color",
					name 		= L["Color"],
					desc 		= L["Color_Desc"],
					get 		= function()
						if (animationTable.text) then
							return animationTable.text.color.r, animationTable.text.color.g, animationTable.text.color.b
						else
							return 1.0, 1.0, 1.0
						end
					end,
					set 		= function(info, r, g, b)
						animationTable.text.color.r = r
						animationTable.text.color.g = g
						animationTable.text.color.b = b
						
						self:UpdateGuideFrame(animationID)
					end,
					hasAlpha 	= false,
					disabled 	= animationTable.text == nil,
				},
				alpha 		= {
					order 		= 8,
					type 		= "range",
					name 		= L["Alpha"],
					desc 		= L["Alpha_Desc"],
					get 		= function()
						return animationTable.text and animationTable.text.alpha or 1.0
					end,
					set 		= function(info, val)
						animationTable.text.alpha = val
						
						self:UpdateGuideFrame(animationID)
					end,
					min 		= 0,
					max 		= 1,
					step 		= 0.01,
					disabled 	= animationTable.text == nil,
				},
				outline 	= {
					order		= 9,
					type 		= "toggle",
					name 		= L["FontOutline"],
					desc 		= L["FontOutline_Desc"],
					get 		= function()
						return animationTable.text and animationTable.text.outline
					end,
					set 		= function(info, val)
						animationTable.text.outline = val
						
						self:UpdateGuideFrame(animationID)
					end,
					disabled 	= animationTable.text == nil,
				},
				isAnimated 		= {
					order 		= 10,
					type 		= "group",
					name 		= L["IsAnimated"],
					desc 		= L["IsAnimated_Desc2"],
					hidden		= not advanced,
					disabled 	= animationTable.text == nil,
					args 		= {
						color 		= {
							order		= 2,
							type 		= "toggle",
							name 		= L["Color"],
							desc 		= L["Color_Desc"],
							get 		= function()
								return animationTable.text and animationTable.text.isAnimated.color or false
							end,
							set 		= function()
								animationTable.text.isAnimated.color = not animationTable.text.isAnimated.color
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						position 	= {
							order 		= 3,
							type 		= "toggle",
							name 		= L["Position"],
							desc		= L["Position_Desc"],
							get 		= function()
								return animationTable.text and animationTable.text.isAnimated.position or false
							end,
							set 		= function()
								animationTable.text.isAnimated.position = not animationTable.text.isAnimated.position
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						scale 		= {
							order 		= 4,
							type 		= "toggle",
							name 		= L["Scale"],
							desc 		= L["Scale_Desc"],
							get 		= function()
								return animationTable.text and animationTable.text.isAnimated.scale or false
							end,
							set 		= function()
								animationTable.text.isAnimated.scale = not animationTable.text.isAnimated.scale
								
								self:UpdateGuideFrame(animationID)
							end,
						},
						alpha 	= {
							order 		= 5,
							type 		= "toggle",
							name 		= L["Alpha"],
							desc 		= L["Alpha_Desc"],
							get			= function()
								return animationTable.text and animationTable.text.isAnimated.alpha or false
							end,
							set 		= function()
								animationTable.text.isAnimated.alpha = not animationTable.text.isAnimated.alpha
								
								self:UpdateGuideFrame(animationID)
							end,
						},
					},
				},
			},
		},
		width 		= {
			order 		= 6,
			type 		= "range",
			name 		= L["Width"],
			desc 		= L["Width_Desc"],
			get 		= function()
				return animationTable.misc.size.width
			end,
			set 		= function(info, val)
				animationTable.misc.size.width = val
				
				self:UpdateGuideFrame(animationID)
			end,
			min 		= 0,
			max 		= math.floor(GetScreenWidth() / UIParent:GetScale()),
			step 		= 1,
		},
		height 		= {
			order 		= 7,
			type 		= "range",
			name 		= L["Height"],
			desc 		= L["Height_Desc"],
			get 		= function()
				return animationTable.misc.size.height
			end,
			set 		= function(info, val)
				animationTable.misc.size.height = val
				
				self:UpdateGuideFrame(animationID)
			end,
			min 		= 0,
			max 		=  math.floor(GetScreenHeight() / UIParent:GetScale()),
			step 		= 1,
		},
		texture 	= {
			order 		= 8,
			type 		= "select",
			name 		= L["Texture"],
			desc 		= L["Texture_Desc"],
			values 		= textureList,
			get 		= function()
				return animationTable.misc.textureFileName
			end,
			set 		= function(info, val)
				-- Set texture (fiile and name)
				animationTable.misc.textureFile 	= textureList[val]
				animationTable.misc.textureFileName = val
				
				-- Request Update
				self.events:Fire("LibAvion_GUIUpdate", animationID)
			end,
			dialogControl = AceGUI.WidgetRegistry["LSM30_Background"] and "LSM30_Background" or nil,
		},
		textureC	 = {
			order 		= 9,
			type 		= "input",
			name 		= L["CustomTexture"],
			desc 		= L["CustomTexture_Desc"],
			get 		= function()
				return animationTable.misc.textureFile
			end,
			set 		= function(info, val)
				animationTable.misc.textureFileName = nil
				animationTable.misc.textureFile 	= val
				
				self:UpdateGuideFrame(animationID)
			end,
			hidden		= not advanced,
		},
		mirrorX 		= {
			order 		= 10,
			type 		= "toggle",
			name 		= L["MirrorX"],
			desc 		= L["MirrorX_Desc"],
			get 		= function()
				return animationTable.misc.mirror.x
			end,
			set 		= function()
				animationTable.misc.mirror.x = not animationTable.misc.mirror.x
				
				self:UpdateGuideFrame(animationID)
			end,
		},
		mirrorY 	= {
			order 		= 11,
			type 		= "toggle",
			name 		= L["MirrorY"],
			desc 		= L["MirrorY_Desc"],
			get 		= function()
				return animationTable.misc.mirror.y
			end,
			set 		= function()
				animationTable.misc.mirror.y = not animationTable.misc.mirror.y
				
				self:UpdateGuideFrame(animationID)
			end,
		},
		sound 		= {
			order 		= 12,
			type 		= "select",
			name 		= L["Sound"],
			desc 		= L["Sound_Desc"],
			values 		= LibSharedMedia:HashTable(LibSharedMedia.MediaType.SOUND),
			get 		= function()
				return animationTable.misc.soundFileName
			end,
			set 		= function(info, val)
				-- Set sound (file and name)
				animationTable.misc.soundFile = LibSharedMedia:Fetch(LibSharedMedia.MediaType.SOUND, val)
				animationTable.misc.soundFileName = val
				
				-- Play sound if there is no widget
				if (not AceGUI.WidgetRegistry["LSM30_Sound"]) then
					PlaySoundFile(val)
				end
			end,
			dialogControl = AceGUI.WidgetRegistry["LSM30_Sound"] and "LSM30_Sound" or nil,
		},
		soundC 		= {
			order 		= 13,
			type 		= "input",
			name 		= L["CustomSound"],
			desc 		= L["CustomSound_Desc"],
			get 		= function()
				return animationTable.misc.soundFile
			end,
			set 		= function(info, val)
				animationTable.misc.soundFileName 	= nil
				animationTable.misc.soundFile 		= val
					
				PlaySoundFile(val)
			end,
			hidden		= not advanced,
		},
		fadeMode 	= {
			order 		= 14,
			type 		= "select",
			name 		= L["fadeMode"],
			desc 		= L["fadeMode_Desc"],
			values 		= {
				[0] = L["JustFade"],
				[1] = L["AnimateAndFade"],
				[2] = L["InvertOnFade"],
				[3] = L["UseSettings"],
			},
			get 		= function()
				return animationTable.misc.fadeMode
			end,
			set 		= function(info, val)
				animationTable.misc.fadeMode = val
				
				self.events:Fire("LibAvion_GUIUpdate", animationID)
				self:UpdateGuideFrame(animationID)
			end,
		},
		showWait 	= {
			order 		= 15,
			type 		= "toggle",
			name 		= L["ShowWhileWait"],
			desc 		= L["ShowWhileWait_Desc"],
			get 		= function()
				return animationTable.misc.showWhileWait
			end,
			set 		= function()
				animationTable.misc.showWhileWait = not animationTable.misc.showWhileWait
				
				self:UpdateGuideFrame(animationID)
			end,
			hidden		= not advanced,
		},
		noEnd 		= {
			order 		= 16,
			type 		= "toggle",
			name 		= L["NoEnd"],
			desc 		= L["NoEnd_Desc"],
			get 		= function()
				return animationTable.misc.noEnd
			end,
			set 		= function()
				animationTable.misc.noEnd = not animationTable.misc.noEnd
				
				self:UpdateGuideFrame(animationID)
			end,
		},
		guideFrame	= {
			order 		= 17,
			type 		= "execute",
			name 		= L["GuideFrame"],
			desc 		= L["GuideFrame_Desc"],
			func 		= function()
				if (not self:IsGuideFrameShown(animationID)) then
					self:ShowGuideFrame(animationID, animationTable)
				else
					self:HideGuideFrame(animationID)
				end
			end
		},
	}
end


--[[
######################################################
# :ShowGuideFrame(animationID, animationTable)
# Notes:
#	Shows a setup-overlay for easier animation configuration.
# Arguments:
#	animationID (string) - The unique identifier for this animation.
#	animationTable (table) - The table that defines this animation, see EOF for more.
# Returns:
######################################################
]]--
function LibAvionOpt:ShowGuideFrame(animationID, animationTable)
	if (not self:IsGuideFrameShown(animationID)) then
		-- Fetch required frames
		local animationObject, animationFrameID = GetAvailableFrame()
		local guideObject, guideFrameID 		= GetAvailableGuideFrame(self.ResizeIconPath)
		
		-- Save link to animation und guide frame that's beeing used
		guideCache[animationID] = {
			animationTable		= animationTable,
			animationFrameID	= animationFrameID,
			guideFrameID		= guideFrameID,
		}
		
		-- Save which triggerID triggerd this animation
		animationObject.triggerID 	= animationID
		guideObject.triggerID 		= animationID
		
		-- Init and Update frame
		guideObject.frame:Show()
		guideObject.texture:Show()
		guideObject.text:Show()
		guideObject.resizeTexture:Show()
		guideObject.slider:Show()
		guideObject.menuButton:Show()
		guideObject.mirrorX:Show()
		guideObject.mirrorY:Show()
		guideObject.closeButton:Show()
		self:UpdateGuideFrame(animationID)
		
		-- Init frame methods
		guideObject.slider:SetScript("OnValueChanged", 
			function() 
				SliderListener(self, animationID)
			end
		)
		guideObject.menuButton:SetScript("OnClick", 
			function() 
				self.events:Fire("LibAvion_MenuRequest", animationID, guideObject.frame) 
			end
		)
		guideObject.mirrorX:SetScript("OnClick",  			
			function()
				animationTable.misc.mirror.x = not animationTable.misc.mirror.x
				self:UpdateGuideFrame(animationID) 	
			end
		)
		guideObject.mirrorY:SetScript("OnClick", 			
			function()
				animationTable.misc.mirror.y = not animationTable.misc.mirror.y
				self:UpdateGuideFrame(animationID) 	
			end
		)
		guideObject.closeButton:SetScript("OnClick",
			function() 
				self:HideGuideFrame(animationID) 	
			end
		)
		guideObject.frame:SetScript("OnMouseDown",		
			function() 
				MouseDownListener(self, animationID) 
			end
		)
		guideObject.frame:SetScript("OnMouseUp",
			function() 
				MouseUpListener(self, animationID) 	
			end
		)
		guideObject.frame:EnableMouseWheel(true)
		guideObject.frame:SetScript("OnMouseWheel", 
			function(this, arg1) 
				MouseWheelListener(self, animationID, arg1) 
			end)
	end
end


--[[
######################################################
# :HideGuideFrame(animationID)
# Notes:
#	Hide setup-overlay again.
# Arguments:
#	animationID (string) - The unique identifier for this animation.
# Returns:
######################################################
]]--
function LibAvionOpt:HideGuideFrame(animationID)
	-- Create frame-memory
	if (self:IsGuideFrameShown(animationID)) then
		-- Fetch required tables
		local animationObject 	= animationFrames[guideCache[animationID].animationFrameID]
		local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]
		
		-- Hide frame and its not inUse anymore...
		animationObject.textureFrame:Hide()
		animationObject.fontFrame:Hide()
		animationObject.inUse = false
		
		-- Clean up
		guideObject.text:SetText("")
		guideObject.inUse = false
		
		-- Hide everything
		guideObject.frame:Hide()
		guideObject.texture:Hide()
		guideObject.text:Hide()
		guideObject.resizeTexture:Hide()
		guideObject.slider:Hide()
		guideObject.menuButton:Hide()
		guideObject.mirrorX:Hide()
		guideObject.mirrorY:Hide()
		guideObject.closeButton:Hide()
		
		
		-- Stop script and clear mem (or atleast give doggy GC something to eat)
		guideObject.slider:SetScript(		"OnValueChanged",	nil)
		guideObject.menuButton:SetScript(	"OnClick", 			nil)
		guideObject.mirrorX:SetScript(		"OnClick", 			nil)
		guideObject.mirrorY:SetScript(		"OnClick", 			nil)
		guideObject.closeButton:SetScript(	"OnClick", 			nil)
		guideObject.frame:SetScript(		"OnMouseDown",		nil)
		guideObject.frame:SetScript(		"OnMouseUp",		nil)
		
		-- Delete frame from guide cache
		guideCache[animationID].animationTable	= nil
		guideCache[animationID]					= nil
	end
end


--[[
######################################################
# :UpdateGuideFrame(animationID)
# Notes:
#	Will (force) the amimation to be updated according to updated animationTable.
# Arguments:
#	animationID (string) - The unique identifier for this animation.
# Returns:
######################################################
]]--
function LibAvionOpt:UpdateGuideFrame(animationID)
	-- Make sure frame is shown
	if (self:IsGuideFrameShown(animationID)) then	
		-- Shorten things
		local animationTable 	= guideCache[animationID].animationTable
		local animationObject 	= animationFrames[guideCache[animationID].animationFrameID]
		local guideObject 		= guideFrames[guideCache[animationID].guideFrameID]
		
		-- Currently in start-value mode
		if (guideObject.configMode == 0) then
			-- Update background color
			guideObject.texture:SetTexture(0, 1, 1)
			guideObject.slider:SetBackdropColor(0, 1, 1, 1)
			guideObject.slider:SetBackdropBorderColor(0, 1, 1, 1)
			guideObject.text:SetText(L["GuideFrameMode0"])
			
			-- Reset position
			guideObject.frame:ClearAllPoints()
			guideObject.frame:SetPoint("CENTER", UIParent, "CENTER", 
				animationTable.init.position.x * UIParent:GetEffectiveScale(), 
				animationTable.init.position.y * UIParent:GetEffectiveScale()
			)
			guideObject.frame:SetWidth(animationTable.misc.size.width   * 1.414)
			guideObject.frame:SetHeight(animationTable.misc.size.height * 1.414)
			guideObject.slider:SetValue(animationTable.init.rotation / math.pi * 180)
		
		-- Currently in animate value mode
		elseif (guideObject.configMode == 1) then
			-- Update background color
			guideObject.texture:SetTexture(1, 1, 0)
			guideObject.slider:SetBackdropColor(1, 1, 0, 1)
			guideObject.slider:SetBackdropBorderColor(1, 1, 0, 1)
			guideObject.text:SetText(L["GuideFrameMode1"])
			
			-- Reset position
			guideObject.frame:ClearAllPoints()
			if (animationTable.anim.misc.isAnimated.position) then
				guideObject.frame:SetPoint("CENTER", UIParent, "CENTER", 
					animationTable.anim.position.x * UIParent:GetEffectiveScale(), 
					animationTable.anim.position.y * UIParent:GetEffectiveScale()
				)
			else
				guideObject.frame:SetPoint("CENTER", UIParent, "CENTER", 
					animationTable.init.position.x * UIParent:GetEffectiveScale(), 
					animationTable.init.position.y * UIParent:GetEffectiveScale()
				)
			end
			
			-- Reste Scale
			if (animationTable.anim.misc.isAnimated.scale) then
				guideObject.frame:SetWidth(animationTable.anim.scale  * animationTable.misc.size.width  * 1.414)
				guideObject.frame:SetHeight(animationTable.anim.scale * animationTable.misc.size.height * 1.414)
			else
				guideObject.frame:SetWidth(animationTable.misc.size.width   * 1.414)
				guideObject.frame:SetHeight(animationTable.misc.size.height * 1.414)
			end
			
			-- Reset Slider
			guideObject.slider:SetValue(animationTable.anim.rotation / math.pi * 180)
		
		-- Currently in fade value mode
		elseif (guideObject.configMode == 2) then
			-- Update background color
			guideObject.texture:SetTexture(1, 0, 1)
			guideObject.slider:SetBackdropColor(1, 0, 1, 1)
			guideObject.slider:SetBackdropBorderColor(1, 0, 1, 1)
			guideObject.text:SetText(L["GuideFrameMode2"])
			
			-- Reset position
			guideObject.frame:ClearAllPoints()
			guideObject.frame:SetPoint("CENTER", UIParent, "CENTER", 
				animationTable.fade.position.x * UIParent:GetEffectiveScale(), 
				animationTable.fade.position.y * UIParent:GetEffectiveScale()
			)
			
			-- Reste Scale
			guideObject.frame:SetWidth(animationTable.fade.scale  * animationTable.misc.size.width  * 1.414)
			guideObject.frame:SetHeight(animationTable.fade.scale * animationTable.misc.size.height * 1.414)
			
			-- Reset Slider
			guideObject.slider:SetValue(animationTable.fade.rotation / math.pi * 180)
		end
		
		-- Reset Frame
		InitFrame(animationObject, animationTable.anim, animationTable.misc, animationTable.text)
		
		-- Update animation
		UpdateAnimation(animationObject, animationTable, false, guideObject.configMode)
	end
end


--[[
######################################################
# :IsGuideFrameShown(animationID)
# Notes:
#	Check if there is allready an setup-overlay assiciated with this identifier.
# Arguments:
#	animationID (string) - The unique identifier for this animation.
# Returns:
#	True if there is allready one, else false.
######################################################
]]--
function LibAvionOpt:IsGuideFrameShown(animationID)
	if (guideCache and guideCache[animationID]) then
		return true
	else
		return false
	end
end


--[[
######################################################
# :ConvertAnimationTable(animationTable, textureList, functionList)
# Notes:
#	Will update the animation table, more precisly, it will set all entrys of animationFunc to
#	its corresponding entry (defined by animationFuncNames entrys) in functionList.
#	You should use this method to initialize your resently loaded animation tables, since functions
#	won't be saved by wow. Just store the functions string identifier 
#	(NOTE: functionList = {[function]=identifier, ...}) in animationFuncNames
#	and use this methode to restore the animation table. (Some goes for texture and sound)
# Arguments:
#	animationTable (table) - The table that defines this animation, see EOF for more.
#	textureList (table) - List of available textures (key=NAME, value=PATH)
#	functionList (table) - List of available fuctions (key=FUNCTION-POINTER, value=NAME)
# Returns:
######################################################
]]--
function LibAvionOpt:ConvertAnimationTable(animationTable, textureList, functionList)
	-- Update texture
	if (animationTable.misc.textureFileName) then
		-- Scan through list, because value=name ...
		for name, path in pairs(textureList) do
			-- Alpha
			if (animationTable.misc.textureFileName == name) then
				animationTable.textureFile = path
			end
			
			break
		end
	end
	
	-- Update sound
	if (animationTable.misc.soundFileName) then
		-- Scan through list, because value=name ...
		for key, value in pairs(LibSharedMedia:HashTable(LibSharedMedia.MediaType.SOUND)) do
			-- Alpha
			if (animationTable.misc.soundFileName == key) then
				animationTable.misc.soundFile = value
			end
			
			break
		end
	end
	
	-- Update function pointers
	local misc
	for i = 1, 2, 1 do
		-- For Animation and fading
		if (i == 1) then
			misc = animationTable.anim.misc
		else
			misc = animationTable.fade.misc
		end
		
		-- Make sure entrys exist
		if (not misc.animationFunc) then
			misc.animationFunc = {}
		end
		
		-- Update pointers
		if (misc.animationFuncName) then
			-- Scan through list, because value=name ...
			for funcPointer, funcName in pairs(functionList) do
				-- Alpha
				if (misc.animationFuncName.alpha == funcName) then
					misc.animationFunc.alpha = funcPointer
				end
				
				-- Color
				if (misc.animationFuncName.color == funcName) then
					misc.animationFunc.color = funcPointer
				end
				
				-- Position
				if (misc.animationFuncName.position == funcName) then
					misc.animationFunc.position = funcPointer
				end
				
				-- Scale
				if (misc.animationFuncName.scale == funcName) then
					misc.animationFunc.scale = funcPointer
				end
				
				-- Rotation
				if (misc.animationFuncName.rotation == funcName) then
					misc.animationFunc.rotation = funcPointer
				end
			end
		end
	end
end


--[[
######################################################
# :Embed(target)
# Notes:
#	Embeds methods listed in local <mixins> into target table.
# Arguments:
#	target (table) - The table on which to export methods onto.
# Returns:
#	The table provided, after embedding.
######################################################
]]--
function LibAvionOpt:Embed(target)
	LibAvionOpt.mixinTargets[target] = true
	
	for _, v in pairs(mixins) do
		target[v] = LibAvionOpt[v]
	end
	
	return target
end


-- Reembed (eg. lib was updated)
for addon in pairs(LibAvionOpt.mixinTargets) do
	LibAvionOpt:Embed(addon)
end


-------------------------------------------------------------------------------
-- Dokumentation - Variables
-------------------------------------------------------------------------------
--[[
VAR: AnimationTable
TYPE: Table
DESC: {
	...
	animationTable.animationFuncNames = {		
		alpha 	= Used for saving (!) which function to use in animationFunc.alpha (string) [OPTIONAL]
		color 		= Used for saving (!) which function to use in animationFunc.color (string) [OPTIONAL]
		position 	= Used for saving (!) which function to use in animationFunc.position (string) [OPTIONAL]
		scale 		= Used for saving (!) which function to use in animationFunc.scale (string) [OPTIONAL]
		rotation 	= Used for saving (!) which function to use in animationFunc.rotation (string) [OPTIONAL]
	} [OPTIONAL]
	textureFileName	= Used for saving (!) which texture to use in textureFile (string) [OPTIONAL]		
	soundFileName	= Used for saving (!) which sound to use in soundFile (string) [OPTIONAL]
	...
}
For more info, take a look at :ConvertAnimationTable(animationTable, textureList, functionList)

		
VAR: guideCache 
TYPE: Table
DESC: Stores all currently active (shown) guide-frames, more speficly the unique key of the
frame (in animationFrames), mostly refered to as the FrameID (or animationFrameID) 
and the unique key of the frame (in guideFrames), mostly refered to as the  
guideFrameID that was assossiated to this animation. The frame thats beeing animated. 
Also saves (a link to)  the table that's used to define the animation.
This table is accessed by the unique key, that was used to show the guide-frame, namely animationID.


VAR: guideFrames
DESC: Table that contains a pool of created/available frame objects to be used for visualising
an animations option. It has "guideFramesCounter" number of entrys and 
the unique key that is used to access it is called guideFrameID.
Each entry inhabits the following entrys:
	inUse 		- Say if the frame is currently beeing used for visualising an animation
	frame 		- the actuell fram object that can be shown or hidden
	texture 		- the texture object
	text 			- Descriptive text
	resizeTexture	- Indicator for resizing the frame
	slider 		- Slider for rotation
	menuButton 	- Button to request a menu
	mirrorX 		- Button to mirror animation on the x axis
	mirrorY 		- Button to mirror animation on the y axis
	closeButton 	- Button to close options
	configMode	- Which values to edit (0 = StartValues; 1 = AnimationValues)


VAR: guideFramesCounter
TYPE: Number
DESC: Its just #guideFramesCounter, nothing more, nothing less


Callbacks:
	LibAvion_MenuRequest(animationID, frame) - Called when a guide-frame requests to open the menu
		animationID	- Unique identifier of this animation
		frame		- Guide-frame that requested menu
	LibAvion_GUIUpdate(animationID) - Something requestet a menu (option table refresh) update, eg. the guide-frame
		animationID	- Unique identifier of this animation
	
EOF]]